﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExcelFileQueryTool
{
    public sealed class ExcelWorkLogSheetNameComparer : IComparer<string>
    {
        public int Compare(string x, string y)
        {
            if (x == y)
                return 0;

            if (x == null)
                return -1;

            if (y == null)
                return 1;

            var xx = x.Split('-');
            var yy = y.Split('-');

            var x1 = int.Parse(xx[0]);
            var y1 = int.Parse(yy[0]);
            if (x1 > y1)
                return 1;
            else if (x1 < y1)
                return -1;

            var x2 = int.Parse(xx[1]);
            var y2 = int.Parse(yy[1]);
            if (x2 >= y2)
                return 1;
            else
                return -1;
        }
    }
}
